how to check a list is null or empty in c#

62

how to check a list is null or empty in c# -

 if ( (myList!= null) && (!myList.Any()) )
 {
     // Add new item
     myList.Add("new item"); 
 }

Comments

Submit
0 Comments